from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from users.models import User
from meiduo_admin.group.group_serializers import GroupModelSerializer, GroupPermissionSerializer
from meiduo_admin.user.my_pagination import MyNumberPagination
from django.contrib.auth.models import Group, Permission


class GroupModelViewSet(ModelViewSet):
    pagination_class = MyNumberPagination
    queryset = Group.objects.all()
    serializer_class = GroupModelSerializer


# 新增用户组返回权限列表
class GroupPermissionViewSet(ListAPIView):
    pagination_class = None
    queryset = Permission.objects.all()
    serializer_class = GroupPermissionSerializer
